export function getCookie(key) {
    let ck = document.cookie
    let arr = ck.split(";")
    for (let i = 0; i < arr.length; i++) {
        let info = arr[i].split("=")
        if (info[0] === key) {
            return info[1]
        }
    }
    return ""
}

export function setCookie(key, value, time = 0) {
    let date = new Date()
    let nowDate = date.getDate()
    date.setDate(nowDate + time)
    document.cookie = key + "=" + value + ";expires" + date
}